//
//  CellMuDiDi.m
//  SeeTheWorld
//
//  Created by dllo on 16/3/2.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellMuDiDi.h"
#import "ModelMuDiDi.h"
#import "PCH.pch"
#import <UIImageView+WebCache.h>


@interface CellMuDiDi ()

@property (nonatomic, retain)UIImageView *imageTouXiang;
@property (nonatomic, retain)UILabel *labelOfNameC;
@property (nonatomic, retain)UILabel *labelOfNameE;
@property (nonatomic, retain)UILabel *labelOfPlace;
@property (nonatomic, retain)UILabel *labelOfCount;
@property (nonatomic, retain)UILabel *labelOfLast;

@end

@implementation CellMuDiDi

- (void)dealloc {
    [_imageTouXiang release];
    [_labelOfCount release];
    [_labelOfLast release];
    [_labelOfNameC release];
    [_labelOfNameE release];
    [_labelOfPlace release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
        
    }
    
    return self;
    
}

- (void)createSubviews {
    
    self.imageTouXiang = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageTouXiang];
    [_imageTouXiang release];
    
    self.labelOfNameC = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfNameC];
    [_labelOfNameC release];
    self.labelOfNameC.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    self.labelOfNameE = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfNameE];
    [_labelOfNameE release];
    self.labelOfNameE.font = [UIFont systemFontOfSize:15];
    self.labelOfNameE.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    
    self.labelOfPlace = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfPlace];
    [_labelOfPlace release];
    self.labelOfPlace.font = [UIFont systemFontOfSize:14];
    self.labelOfPlace.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    
    self.labelOfLast = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfLast];
    [_labelOfLast release];
    self.labelOfLast.font = [UIFont systemFontOfSize:14];
    self.labelOfLast.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    
    self.labelOfCount = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelOfCount];
    [_labelOfCount release];
    self.labelOfCount.font = [UIFont systemFontOfSize:13];
    self.labelOfCount.dk_textColorPicker = DKColorWithRGB(0x343434, 0xffffff);

    
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageTouXiang.frame = CGRectMake(10, 10, scWIDTH / 3 , scHEIGHT - 20);
    self.labelOfNameC.frame = CGRectMake(10 + scWIDTH / 3 + 10, 10, scWIDTH / 3 * 1.8, (scHEIGHT - 50) / 4 + 10);
    self.labelOfNameE.frame = CGRectMake(10 + scWIDTH / 3 + 10, 10 + (scHEIGHT - 50) / 4 + 10 + 5, scWIDTH / 3 * 1.8, (scHEIGHT - 50) / 4 + 5);
    self.labelOfPlace.frame = CGRectMake(10 + scWIDTH / 3 + 10, 10 + (scHEIGHT - 50) / 4 + 10 + 5 + (scHEIGHT - 50) / 4 + 5 + 5, scWIDTH / 3 * 1.8, (scHEIGHT - 50) / 4 + 5);
    self.labelOfCount.frame = CGRectMake(10 + scWIDTH / 3 + 10, 10 + (scHEIGHT - 50) / 4 + 10 + 5 + (scHEIGHT - 50) / 4 + 5 + 5 + (scHEIGHT - 50) / 4 + 5 + 5, scWIDTH / 3 * 1.8, (scHEIGHT - 50) / 4 + 5);
    
    self.labelOfLast.frame = CGRectMake(scWIDTH / 6 * 5, scHEIGHT / 2, scWIDTH / 6, 30);
    
}

- (void)passModel:(ModelMuDiDi *)model {
    
    [self.imageTouXiang sd_setImageWithURL:[NSURL URLWithString:model.photo] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    self.labelOfNameC.text = model.cnname;
    self.labelOfNameE.text = model.enname;
    self.labelOfPlace.text = model.parentname;
    self.labelOfCount.text = model.beenstr;
    
    self.labelOfLast.text = model.label;
}











@end
